#ifndef _UTILITY_H
#define _UTILITY_H_

// TCP IP protocol

BOOL	tcpTAGRequest(SOCKET& Socket);
int		tcpReceiveData(SOCKET& Socket,BOOL& bTerminated, void* data, int Len);
int		recvtimeout(int s, char *buf, int len, int timeout);
int		recvfromtimeout(int s, char *buf, int max, LPSOCKADDR sa, int* len, int timeout);


DWORD GetLocalHostIP(int No);	// returns IP number by index

char* GetIPStr(DWORD IP);		// converts IP number to string


void GetDate(const char* szDate, int& nDay, int& nMonth, int& nYear);
void GetTime(const char* szTime, int& nSecond, int& nMinute, int& nHour);
void GetFileName(const char* szDate, int nCameraID, CString& strFileName);

#endif